<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>已删除邮件</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            font-family: Arial, sans-serif;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            background-color: #f7f7f7;
        }
        .container {
            width: 90%;
            max-width: 1200px;
            background-color: white;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        h1 {
            text-align: center;
            font-size: 36px;
            margin-bottom: 20px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }
        table th, table td {
            padding: 10px;
            border: 1px solid #ddd;
            text-align: center;
        }
        table th {
            background-color: #f1f1f1;
        }
        table tr:hover {
            background-color: #f9f9f9;
        }
        table td button {
            padding: 5px 10px;
            font-size: 12px;
            color: white;
            background-color: #007bff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        table td button:hover {
            background-color: #0056b3;
        }
        .footer {
            text-align: center;
            margin-top: 20px;
        }
        .footer button {
            padding: 10px 20px;
            font-size: 16px;
            color: white;
            background-color: #007bff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        .footer button:hover {
            background-color: #0056b3;
        }
    </style>
    <script>
        function confirmPermanentDelete() {
            return confirm('确定要永久删除这封邮件吗？此操作不可撤销。');
        }
    </script>
</head>
<body>
    <div class="container">
        <h1>已删除邮件</h1>
        <table>
            <thead>
                <tr>
                    <th>邮件标题</th>
                    <th>时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {% for email in emails %}
                <tr>
                    <td>{{ email.title }}</td>
                    <td>{{ email.create_time }}</td>
                    <td>
                        <!-- 恢复邮件 -->
                        <form action="{{ url_for('main.restore_email', eid=email.eid) }}" method="post" style="display:inline;">
                            <button type="submit">恢复</button>
                        </form>
                        <!-- 永久删除邮件 -->
                        <form action="{{ url_for('main.permanent_delete_email', eid=email.eid) }}" method="post" onsubmit="return confirmPermanentDelete();" style="display:inline;">
                            <button type="submit" style="background-color: #dc3545;">永久删除</button>
                        </form>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</body>
</html>
